import { HYEventStore } from 'hy-event-store'
import { getPlayList } from '../services/index'
export const rankingsMap = {
  newRanking: 3779629,
  originRanking: 2884035,
  upRanking: 19723756
}
const menuStore = new HYEventStore({
  state:{
    upRanking:{},
    originRanking:{},
    newRanking:{}
  },
  actions:{
    async fetchRankingAction(ctx){
      for (const key in rankingsMap) {
        const id = rankingsMap[key]
        getPlayList(id).then(res=>{
          ctx[key] = res.playlist 
        })
        // if (Object.hasOwnProperty.call(rangkingMap, key)) {
        //   const element = rankingsMap[key];
          
        // }
      }
    }
  }
})
export default menuStore